/*     */ package com.zimbra.qa.unittest.prov;
/*     */ 
/*     */ import com.zimbra.cs.account.IDNUtil;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class Names
/*     */ {
/*     */   private static final String ATOM_CHARS = "!#$%&'*+-/=?^_`{|}~";
/*     */   private static final String DOT_ATOM_CHARS = ".!#$%&'*+-/=?^_`{|}~";
/*     */   
/*     */   public static class IDNName
/*     */   {
/*     */     String mUincodeName;
/*     */     String mAsciiName;
/*     */     
/*     */     public IDNName(String uName)
/*     */     {
/*  28 */       this.mUincodeName = uName;
/*     */       
/*  30 */       String[] parts = uName.split("@");
/*  31 */       if (parts.length == 2) {
/*  32 */         this.mAsciiName = (parts[0] + "@" + IDNUtil.toAsciiDomainName(parts[1]));
/*     */       } else
/*  34 */         this.mAsciiName = IDNUtil.toAsciiDomainName(uName);
/*     */     }
/*     */     
/*     */     public IDNName(String localPart, String uName) {
/*  38 */       this.mUincodeName = (localPart + "@" + uName);
/*  39 */       this.mAsciiName = (localPart + "@" + IDNUtil.toAsciiDomainName(uName));
/*     */     }
/*     */     
/*  42 */     public String uName() { return this.mUincodeName; }
/*  43 */     public String aName() { return this.mAsciiName; }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   private static String makeRFC2253Name(String name, boolean wantTrailingBlank)
/*     */   {
/*  72 */     String LEADING_CHARS = "#";
/*  73 */     String TRAILING_CHARS = " ";
/*  74 */     String BACKSLASH_ESCAPED_CHARS = "# ,+\"\\<>;";
/*  75 */     String UNICODE_CHARS = "中文";
/*     */     
/*  77 */     if (wantTrailingBlank) {
/*  78 */       return LEADING_CHARS + BACKSLASH_ESCAPED_CHARS + ".!#$%&'*+-/=?^_`{|}~" + UNICODE_CHARS + "---" + name + TRAILING_CHARS;
/*     */     }
/*  80 */     return LEADING_CHARS + BACKSLASH_ESCAPED_CHARS + ".!#$%&'*+-/=?^_`{|}~" + UNICODE_CHARS + "---" + name;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   private static String makeRFC2253NameEmailLocalPart(String name)
/*     */   {
/*  89 */     String LEADING_CHAR = "#";
/*  90 */     return LEADING_CHAR + ".!#$%&'*+-/=?^_`{|}~" + "---" + name;
/*     */   }
/*     */   
/*     */   private static String makeRFC2253NameDomainName(String name) {
/*  94 */     String UNICODE_CHARS = "中文";
/*     */     
/*     */ 
/*     */ 
/*  98 */     return UNICODE_CHARS + "---" + name;
/*     */   }
/*     */   
/*     */   public static String makeAccountNameLocalPart(String localPart) {
/* 102 */     return makeRFC2253NameEmailLocalPart(localPart);
/*     */   }
/*     */   
/*     */   public static String makeAliasNameLocalPart(String localPart) {
/* 106 */     return makeRFC2253NameEmailLocalPart(localPart);
/*     */   }
/*     */   
/*     */   public static String makeCosName(String name) {
/* 110 */     return makeRFC2253Name(name, false);
/*     */   }
/*     */   
/*     */ 
/*     */   public static String makeDataSourceName(String name)
/*     */   {
/* 116 */     return makeRFC2253Name(name, true);
/*     */   }
/*     */   
/*     */   public static String makeDLNameLocalPart(String localPart) {
/* 120 */     return makeRFC2253NameEmailLocalPart(localPart);
/*     */   }
/*     */   
/*     */   public static String makeDomainName(String name) {
/* 124 */     return makeRFC2253NameDomainName(name);
/*     */   }
/*     */   
/*     */ 
/*     */   public static String makeIdentityName(String name)
/*     */   {
/* 130 */     return makeRFC2253Name(name, true);
/*     */   }
/*     */   
/*     */   public static String makeServerName(String name) {
/* 134 */     return makeRFC2253Name(name, false);
/*     */   }
/*     */   
/*     */   public static String makeSignatureName(String name) {
/* 138 */     return makeRFC2253Name(name, false);
/*     */   }
/*     */   
/*     */   public static String makeXMPPName(String name) {
/* 142 */     return makeRFC2253Name(name, false);
/*     */   }
/*     */   
/*     */   public static String makeZimletName(String name) {
/* 146 */     return makeRFC2253Name(name, false);
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/prov/Names.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */